<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--
/**********************************************************************
 *
 * $Id: iframe.html,v 1.6 2006/02/07 03:19:55 pspencer Exp $
 *
 * purpose: use as the source of an iframe to embed a ka-Map application
 *          inside another page.  The intention is that you would copy
 *          this page and then add more javascript functions and user
 *          interface to it.
 *
 * author: Paul Spencer (pspencer@dmsolutions.ca)
 *
 **********************************************************************
 *
 * Copyright (c) 2005, DM Solutions Group Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 *
 **********************************************************************/
  
-->
<meta http-equiv="imagetoolbar" content="no">
<title>ka-Map!</title>
<script type="text/javascript" src="DHTMLapi.js"></script>
<script type="text/javascript" src="xhr.js"></script>
<script type="text/javascript" src="kaMap.js"></script>
<script type="text/javascript" src="kaTool.js"></script>
<script type="text/javascript" src="wz_dragdrop.js"></script>
<script type="text/javascript" src="kaZoomer.js"></script>
<script type="text/javascript">
var myKaMap = null;
var queryParams = null;
SET_DHTML();

/**
 * parse the query string sent to this window into a global array of key = value pairs
 * this function should only be called once
 */
function parseQueryString()
{
    queryParams = [];
    var s=window.location.search;
    if (s!='')
    {
        s=s.substring( 1 );
        var p=s.split('&');
        for (var i=0;i<p.length;i++)
        {
            var q=p[i].split('=');
            queryParams[q[0]]=q[1];
        }
    }
}

/**
 * get a query value by key.  If the query string hasn't been parsed yet, parse it first.
 * Return an empty string if not found
 */
function getQueryParam(p)
{
    if (!queryParams)
    {
        parseQueryString();
    }
    if (queryParams[p])
        return queryParams[p];
    else 
        return '';
}

function myOnLoad()
{
    initDHTMLAPI();
    
    var map = getQueryParam('map');
    var extents = getQueryParam('extents');
    var cps = getQueryParam('cps');
    
    myKaMap = new kaMap( 'viewport' );
    var kaNav = new kaNavigator( myKaMap );
    kaNav.activate();
    myKaZoomer = new kaZoomer(myKaMap); 
    drawPage();
    myKaMap.initialize( map, extents, cps );
}

function drawPage()
{
    var browserWidth = getInsideWindowWidth();
    var browserHeight = getInsideWindowHeight();
    
    var viewport = getRawObject('viewport');
    
    viewport.style.width = browserWidth + "px";
    viewport.style.height = browserHeight + "px";
    
    myKaMap.resize();
}
</script>
<style type="text/css">
body {
  margin: 0px;
  padding: 0px;
  background-color: #d9d9d9;
  overflow: hidden;
}

#viewport {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #f0f0f0;
  overflow: hidden;
  border: 1px solid #000000;
  cursor: move;
  -moz-box-sizing: border-box;
}

a { 
  text-decoration: none; 
  font-family: arial;
  font-size: 10px;
  color: #000033;
}

a:link {}
a:hover {}
a:active {}
a:visited {}

#kaLogo {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 2;
}

</style>
</head>
<body onload="myOnLoad();" onresize="drawPage();">
<div id="viewport">
<div id="kaLogo"><a target="_blank" href="http://www.maptools.org/"><img src="images/powered_by_kamap_lt.png" width="85"
height="23" border="0"></a></div>
</div>
</body>
</html>

